package com.joy.common.sitmesh;

import org.sitemesh.builder.SiteMeshFilterBuilder;
import org.sitemesh.config.ConfigurableSiteMeshFilter;
import org.sitemesh.content.tagrules.TagRuleBundle;

import java.util.ArrayList;
import java.util.List;

public class WebSiteMeshFilter extends ConfigurableSiteMeshFilter {

	public static final String DECORATOR_URL="/decorator/index";

	@Override
	protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
		builder.addDecoratorPath("/*", DECORATOR_URL)

				.addExcludedPath(DECORATOR_URL)
		    	.addExcludedPath("/static/*")
		    	.addExcludedPath("/login")
				.addExcludedPath("/login/**")
				.addExcludedPath("/file/**");

		//添加更多的 mime 类型
		builder.setMimeTypes("text/html", "application/xhtml+xml", "application/vnd.wap.xhtml+xml");
//
		List<TagRuleBundle> tagRuleBundleList = new ArrayList<TagRuleBundle>();
		tagRuleBundleList.add(new TopTagRuleBundle());
		tagRuleBundleList.add(new CssTagRuleBundle());
		tagRuleBundleList.add(new scriptTagRuleBundle());
		builder.addTagRuleBundles(tagRuleBundleList);
	}
	
	
	
}
